from threading import Thread

class SeedWorker(Thread):
    def __init__(self, sock, chunck_id, brook):
        super(SeedWorker, self).__init__()
        self._conn = sock
        self._chunck_id = chunck_id
        self._brook = brook

    def run(self):
        self._data = self._brook.get_chunk(self._chunck_id)
        send = 0
        while send < len(self._data):
            send = send + self._conn.send(self._data[send:])